import dva from 'dva';
import createLoading from 'dva-loading';
import routes from '@/routes';
import models from '@/models';
import {message} from 'antd';
import createHistory from '@/utils/createHistory';
import('xeacss');
import('@/assets/css/index.css');
if (process.env.NODE_ENV === 'development') {
    require('antd/dist/antd.less');
}

const app = dva({
    history: createHistory('Browser'), // Browser || Hash
    onError(err) {
        err.preventDefault();
        message.error(err.message, 3);
    }
});

app.use(createLoading());
app.model(models);
app.router(routes);
app.start('#root');

export default {
    app,
    store: app._store,
    dispatch: app._store.dispatch
};
